package com.ihd.ihardware.view.tzc.me.viewmodel;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.support.annotation.NonNull;

import com.ihd.ihardware.view.tzc.me.model.MemberRepository;

public class DocumentViewModel extends AndroidViewModel {

    private MemberRepository mMemberRepository;

    public DocumentViewModel(@NonNull Application application) {
        super(application);
    }

    public void healthRecord() {
        if (mMemberRepository == null)
            mMemberRepository = new MemberRepository();
        mMemberRepository.healthRecord();
    }

    public void editHealthRecord(String birthday, String exerciseFrequency, String health, String height, String id, String sex, String waist, String want, String weight, String eatingHabits) {
        if (mMemberRepository == null)
            mMemberRepository = new MemberRepository();
        mMemberRepository.healthRecord(birthday, exerciseFrequency, health, height, id, sex, waist, want, weight, eatingHabits);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        if (null != mMemberRepository) {
            mMemberRepository.onDestroy();
            mMemberRepository = null;
        }
    }
}
